<template>
  <div class="brand-detail">
    <div class="container">
      <!-- 面包屑 -->
      <XtxBread>
        <XtxBreadItem to="/">首页</XtxBreadItem>
        <transition name="fade-right" mode="out-in">
          <XtxBreadItem>品牌列表</XtxBreadItem>
        </transition>
        <transition name="fade-right" mode="out-in">
          <XtxBreadItem>品牌详情</XtxBreadItem>
        </transition>
      </XtxBread>
      <!-- 品牌信息 -->
      <div class="brand-info">
        <div class="image">
          <img :src="brandInfo.brandImage" alt="">
        </div>
        <div class="info">
          <p class="name">{{brandInfo.name}}</p>
          <p class="desc">{{brandInfo.slogan}}</p>
          <p class="icon">
            <i class="iconfont icon-dingwei"></i>
            <span>{{brandInfo.productionPlace}}</span>
            <i class="iconfont icon-xin2 red"></i>
            <span>{{brandInfo.collectNum}}</span>
          </p>
          <p class="text">
            <span>品牌故事：</span>
            <span>{{brandInfo.brandStory}}</span>
          </p>
          <a class="like" href="javascript:;" @click="followBrand">关注品牌</a>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { useRoute } from 'vue-router'
import { findBrandDetail } from '@/api/brand'
import { ref } from 'vue'
import Message from '@/components/library/message'
export default {
  name: 'BrandDetail',
  setup () {
    const route = useRoute()
    const brandInfo = ref({})
    findBrandDetail(route.params.id).then(data => {
      brandInfo.value = data.result
    })
    const followBrand = () => {
      Message({ type: 'success', text: '已关注成功' })
    }
    return { brandInfo, followBrand }
  }
}
</script>

<style lang="less" scoped>
.brand-info {
  display: flex;
  background: #fff;
  height: 300px;
  img {
    width: 100%;
    height: 100%;
  }
  .image {
    width: 650px;
    height: 300px;
  }
  .info {
    flex: 1;
    padding: 0 30px;
    position: relative;
    .name {
      font-size: 20px;
      padding-right: 160px;
      line-height: 50px;
    }
    .icon {
      color: #999;
      line-height: 50px;
      .red {
        color: red;
      }
    }
    .text {
      line-height: 28px;
      color: #666;
    }
    .like {
      width: 150px;
      height: 46px;
      background: #27ba9b;
      border-radius: 4px;
      color: #fff;
      text-align: center;
      line-height: 46px;
      margin: 0 30px;
      position: absolute;
      top: 30px;
      right: 0;
    }
  }
}
</style>
